<?php

namespace app\admin\model;

use think\Model;
use think\model\relation\BelongsTo;


class Appconfig extends Model
{

    // 表名
    protected $name = 'app_config';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];

    /**
     * 配置类型映射
     */
    const CONFIG_VALUE_TYPE_MAP = [
        'string' => '文字',
        'number' => '数字',
        'password' => '密码',
        'text' => '段落',
        'editor' => '富文本',
        'list' => '列表',
        'image' => '单图',
        'map' => '字典',
        'date' => '年月日',
        'time' => '时分秒',
        'datetime' => '年月日时分秒',
        'datetime-range' => '时间范围',
        'switch' => '开关',
    ];

    public function app(): BelongsTo
    {
        return $this->belongsTo('app\admin\model\App', 'app_id', 'app_id', [], 'LEFT')->setEagerlyType(0);
    }
}
